package com.hefei.garden.service.impl;

import com.hefei.garden.mapper.UserMapper;
import com.hefei.garden.pojo.domain.UserInfo;
import com.hefei.garden.pojo.dto.UserInfoDto;
import com.hefei.garden.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * @author: devil
 * @Date: 2022/7/17 15
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @Override
    public void insertUserInfo(UserInfo userInfo) {
        // 用户唯一码生成
        String uuid = UUID.randomUUID().toString().replace("-", "");
        userInfo.setUserUniqueCode(uuid);
        userMapper.insertUserInfo(userInfo);
    }

    @Override
    public List<UserInfo> getUserInfoByParam(UserInfoDto userInfoDto) {
        return userMapper.getUserInfoByParam(userInfoDto);
    }
}
